#!/usr/bin/node

var http=require('http'); 
http.createServer(function (req, res) {  
  var split_url=req.url.split("/");
  if ( split_url[1] == '' ) { 
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Portada');     
  } else if ( split_url[1] == 'proc' ) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('No es la portada');     
  } else {
    res.writeHead(400, {'Content-Type': 'text/plain'});
    res.end('Error 400: Bad Request'); 
  } 
}).listen(8080, '127.0.0.1'); 
console.log('Server running at http://127.0.0.1:8080/');
